USE [MTNOH_SH_APP]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FUNC_GetDictionaryNameStr]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[FUNC_GetDictionaryNameStr]
GO

USE [MTNOH_SH_APP]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


create FUNCTION [dbo].[FUNC_GetDictionaryNameStr]
(
        @IDStr varchar(5000)
        ,@splitChar char
        ,@joinChar char
)
RETURNS VARCHAR(500)
AS
BEGIN
    DECLARE @CODE VARCHAR(1000) 
	set @CODE=''
    if(@IDStr<>'')
	begin
		SELECT @CODE=@CODE + b.Name + @joinChar 
		from dbo.T_Dictionary b 
		where b.ID in (select * from dbo.FUNC_ChangeStr(@IDStr,@splitChar))
		if @CODE <> ''
		  set @CODE = substring(@CODE,1,LEN(@CODE)-1)
	end

	return @CODE
END


GO


